-
Notifications
You must be signed in to change notification settings - Fork 889
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support hiding window title when using vertical tab strip #15523
Conversation
6851d00
to
2858f52
Compare
2858f52
to
975dc2f
Compare
5ad9948
to
74512c2
Compare
app/brave_generated_resources.grd
Outdated
</if> | ||
<if expr="use_titlecase"> | ||
<message name="IDS_TAB_CXMENU_BOOKMARK_ALL_TABS" desc="In Title Case: The label of the tab context menu item for creating a bookmark folder containing an entry for each open tab."> | ||
Bookmark All Tabs... | ||
</message> | ||
<message name="IDS_TAB_CXMENU_SHOW_TITLE_BAR" desc="The label of the tab context menu item for showing window title when vertical tab strip is enabled."> | ||
Show Window Title |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's kinda annoying how we have to do this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, indeed. I wish we could automate casing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, might be worth trying to add some browser tests though. I'm excited for this feature!
Edit:
I just tried changing the theme to Use GTK
- it crashes the latest nightly when vertical tabs are enabled. On your branch it does nothing (even when vertical tabs are disabled). Might be worth looking into.
Also, playing around with the setting on Linux it's quite hard to drag the window around now
And I think the window icons come a bit out of the frame
chromium_src/chrome/browser/ui/views/frame/browser_frame_view_layout_linux.cc
Show resolved
Hide resolved
chromium_src/chrome/browser/ui/views/frame/browser_frame_view_layout_linux.cc
Outdated
Show resolved
Hide resolved
Err, it might be due to overlay mode. Let me check it out.
It seems HTCAPTION things are not working as expected on Linux. @simonhong Are you using linux too?
This shouldn't happen :( The height looks incorrect when using GTK theme.
It seems your version uses caption button based on vector icon, which I didn't expect:( 18 seems to be too short for it. Let me dig this deeper. Anyway, I think dragging with toolbar area should work now. |
Yeah, I totally agree. I'm considering that too but window title implementation for each platform differs so I think I could do it as a follow-up. |
98bcbd7
to
5336bd8
Compare
Now we have browser tests too and other things are addressed, I think. @simonhong @fallaciousreasoning Do you mind taking another look? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
return overridden_window_title_visibility_.has_value(); \ | ||
} \ | ||
bool overridden_window_title_visibility() const { \ | ||
return overridden_window_title_visibility_.value(); \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we do a .value_or(false)
here? It's not obvious that the method will crash if you don't check has_overridden_window_title_visibility
first.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not obvious that the method will crash
I thought it'd crash, but it seems it's close to undefined behavior. I think it's better to let it crash to detect problems for some cases, and this is the case. And also I intentionally didn't use .value_or()
here, because when there's no overridden visibility, we should use WidgetDelegate::ShouldShowWindowTitle() to know about the default visibility.
Now I find it that DCHECK(has_overriden_visibility()) << "Use WidgetDelegate::ShouldShowWindowTitle()"
is more explicit and better, thanks to your comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
96575b3
to
9fdcb57
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
++ 👍🏼
chromium_src/components/remote_cocoa/app_shim/native_widget_ns_window_bridge.mm
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
few nits + can you please double-check that new chromium overrides are fine without VerticalTabs enabled? to make sure we didn't break some edge case when the feature is off.
if (const gfx::ImageSkia* image = tp->GetImageSkiaNamed(image_id)) | ||
width += image->width(); | ||
} | ||
return {0, width}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are all of these numbers work correctly with different OS-level screen scale?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it looks so. Both seems to be DIP.
return GlassBrowserFrameView::GetTopInset(restored); | ||
} | ||
int BraveGlassBrowserFrameView::NonClientHitTest(const gfx::Point& point) { | ||
if (auto res = brave::NonClientHitTest(browser_view(), point); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this check VerticalTabs feature?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we'd better to support this for others too. brave/brave-browser#25757
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you please double-check that new chromium overrides are fine without VerticalTabs enabled?
Yep sure. Confirmed that there's no crash and frame view works well without the flag.
I found that one of macro was undef-ed, fixed it and add a static check for it. PTAL thanks :)
return GlassBrowserFrameView::GetTopInset(restored); | ||
} | ||
int BraveGlassBrowserFrameView::NonClientHitTest(const gfx::Point& point) { | ||
if (auto res = brave::NonClientHitTest(browser_view(), point); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we'd better to support this for others too. brave/brave-browser#25757
if (const gfx::ImageSkia* image = tp->GetImageSkiaNamed(image_id)) | ||
width += image->width(); | ||
} | ||
return {0, width}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it looks so. Both seems to be DIP.
5675d49
to
50ce5ed
Compare
Add a tab context menu to hide window title when vertical tab strip is enabled. When hiding window title, we can claim title area so that users can use taller contents area. * On Mac and Window, toolbar will take the title area. * On Linux, title area will be as short as possible * can't overlay caption buttons on toolbar for now. Also, we should make it easy to move window when hiding window title as there's almost no non-client area. Thus, enable dragging windows by dragging toolbar area.
Add a tab context menu to hide window title when vertical tab strip is enabled. When hiding window title, we can claim title area so that users can use taller contents area. * On Mac and Window, toolbar will take the title area. * On Linux, title area will be as short as possible * can't overlay caption buttons on toolbar for now. Also, we should make it easy to move window when hiding window title as there's almost no non-client area. Thus, enable dragging windows by dragging toolbar area.
When TabStrip::ShouldDrawColor() returns true, BrowserRootView will try to clip bounds tab strip. But When vertical tabstrip is enabled, converting coordinate system will fail as we have another widget for vertical tab strip. As we don't have to draw strokes below vertical tab strip, returning false will be okay for our purpose.
d02e2c8
to
22e94a4
Compare
22e94a4
to
8ec1ab6
Compare
Thank you all for reviewing this :) |
} | ||
return {0, width}; | ||
#else | ||
#error "not handled platform" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NOTREACHED()
Resolves brave/brave-browser#25473
Resolves brave/brave-browser#25757
Add a tab context menu to hide window title when vertical tab strip is enabled. When hiding window title, we can claim title area so that users can use taller contents area.
Also, we should make it easy to move window when hiding window title as there's almost no non-client area. Thus, enable dragging windows by dragging toolbar area.
Windows glass frame
no title
with title
Windows opaque frame
with title
no title
Mac
With title
no title
Linux
With title
No title
Submitter Checklist:
QA/Yes
orQA/No
;release-notes/include
orrelease-notes/exclude
;OS/...
) to the associated issuenpm run test -- brave_browser_tests
,npm run test -- brave_unit_tests
,npm run lint
,npm run gn_check
,npm run tslint
git rebase master
(if needed)Reviewer Checklist:
gn
After-merge Checklist:
changes has landed on
Test Plan:
Manual
Automated
VerticalTabstripBrowserTest.WindowTitleVisibility.Toolbar
BraveNonClientHitTestHelperBrowserTest.WindowTitle